package com.xzq.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
@Entity
public class District implements Serializable {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	@Column(nullable=false,length=30)
	private String name;
	@OneToMany(cascade={CascadeType.MERGE},fetch=FetchType.LAZY)
	@JoinColumn(name="district_id",insertable=true)
	private Set<Aqi> aqis = new HashSet<Aqi>(0);
	public Set<Aqi> getAqis() {
		return aqis;
	}
	public void setAqis(Set<Aqi> aqis) {
		this.aqis = aqis;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public District(Integer id, String name, Set<Aqi> aqis) {
		this.id = id;
		this.name = name;
		this.aqis = aqis;
	}
	public District(String name, Set<Aqi> aqis) {
		super();
		this.name = name;
		this.aqis = aqis;
	}
	public District() {
	}
	@Override
	public String toString() {
		return "District [id=" + id + ", name=" + name + "]";
	}
	
}
